class OauthsController < ActionController::Base
  
  def callback
#    token_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=authorization_code&code=#{params[:code]}&client_id=GWrkASOSFEQ0vCrDBGWDSlGq&client_secret=hA9OU9yb4DtnAZYXG3pkjbMsrqSKgcjq&redirect_uri=http://et.mytusi.com/"
    @authorization_code = params[:code]

    client = OAuth2::Client.new(Property.baidu_api_key, Property.baidu_secret_key, :site => Property.site, :token_url => Property.token_url)
    token = client.auth_code.get_token(params[:code], :redirect_uri => "#{Property.dns}/oauth/callback")
    response = token.get('http://openapi.baidu.com/rest/2.0/passport/users/getLoggedInUser', :params => token.params)
    logger.debug "response.class.name==================#{response.class.name}"
    logger.debug "response.body==================#{response.body}"
  end

  def show
  end
end
